package net.sxnic.workflow.task.action;

import java.util.List;

import net.sxinfo.core.dao.Page;
import net.sxinfo.core.util.WebUtils;
import net.sxnic.comm.CommConstant;
import net.sxnic.ugr.context.AppContext;
import net.sxnic.workflow.task.Task;
import net.sxnic.workflow.task.TaskWrapper;

import org.apache.commons.lang.StringUtils;

/**
 * 
 * Comments: 代办任务列表显示action,纪委系统只显示未办的任务
 * <p>
 * Author：孙宇飞
 * <p>
 * Create Date：2009-10-20
 * <p>
 * 
 * 
 */
@SuppressWarnings("serial")
public class Browse extends TaskAction {

	public static final String TASK_LIST_SESSIONID = "t_l_sid";

	private Page tasks;

	private String status;

	private List<TaskWrapper> list;

	/**
	 * 查询类型
	 */
	private String type;

	/**
	 * 已处理任务数
	 */
	private int dealed;

	/**
	 * 未处理任务数
	 */
	private int undealed;

	public String execute() throws Exception {

		int page = WebUtils.getPageNumber(request);
		int pageSize = WebUtils.getPageSize(request);
		try {
			// 从属性表中读取每页显示数
			if (StringUtils.isNotBlank(CommConstant.PROPERTY_MAP
					.get("tasklist.num"))) {
				pageSize = Integer.parseInt(CommConstant.PROPERTY_MAP
						.get("tasklist.num"));
			}

			if (StringUtils.isBlank(status)) {
				status = Task.TASK_STATUS_ACTIVE;
			}

			if (StringUtils.isBlank(type) || "00".equals(type)) {
				
			} else {
				
			}
			list = treatWrappertoList(tasks.getResults());
		} catch (Exception e) {
			e.printStackTrace();
		}

		return SUCCESS;
	}

	public Page getTasks() {
		return tasks;
	}

	public void setTasks(Page tasks) {
		this.tasks = tasks;
	}

	public List<TaskWrapper> getList() {
		return list;
	}

	public void setList(List<TaskWrapper> list) {
		this.list = list;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getDealed() {
		return dealed;
	}

	public void setDealed(int dealed) {
		this.dealed = dealed;
	}

	public int getUndealed() {
		return undealed;
	}

	public void setUndealed(int undealed) {
		this.undealed = undealed;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
